home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u3.d64
/
multicopy.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-11
|
4KB
|
129 lines
0 POKE55,0:POKE56,160
1 FORI=828TO883:READA:POKEI,A:NEXTI
2 REM MODIFIED FROM 'BACKUP 1541' I GIVE CREDIT AND APOLOGIES TO HARVEY HERMAN
3 REM MODIFICATION BY JERRY BYBEE, 404 ROSEMERE, MAQUOKETA IA 52060
10 REM"D=DSAVE"@BACK2",DO:?DS%:CATALOGD0
20 BB[178][194](44)[170]27:[151]995,BB
30 [151]998,[194](55):[151]999,[194](56):[151]55,0:[151]56,BB:[156]
40 BB[178][194](995)
50 N[178][194](999)[171]BB[171]1:BA[178]BB[172]256:MA[178]828
60 [134]BM%(35,24)
70 [129]J[178]0[164]7:TA(J)[178]2[174]J:[130]J
80 [153]"LOADMULTICOPY 1541WAIT"
82 [153]:[153]"DESTINATION DISKS MUST BE ALREADY FORMATTED"
84 [153]:[153]"YOU CAN COPY ANY # OF DESTINATION DISKS FROM ONE PASS OF THE SOURCE
85 PRINT"DISK
86 [153]:[153]"MAKE SURE TO KEEP TRACK OF WHAT YOU'VE COPIED TO EACH DISK
90 PRINT"'GOTO 10000' IF PROGRAM QUITS ABNORMALLY"
100 PRINT""N"BUFFERS AVAILABLE"
110 OPEN1,8,15
200 REM MAIN FUNCTIONS
220 D$="S":GOSUB3220
250 GOSUB2500
260 T=TS:S=0:NU=1:T1=T:S1=S
270 PRINT#1,"I0":OPEN3,8,3,"#"
280 PRINT"READING BLOCK #";
281 T2=T1:S2=S1
290 IFBM%(T1,S1)=0THENGOSUB2000:NU=NU+1:IFNU>NTHEN320
300 S1=S1+1:IFS1>20THENS1=0:T1=T1+1
310 IFT1<TF+1THEN290
320 PRINT""
330 CLOSE3
340 D$="D":GOSUB3200
350 NU=1:T1=T:S1=S
360 T2=T:S2=S
365 PRINT"WRITING BUFFER #";
370 PRINT#1,"I0":OPEN3,8,3,"#"
380 IFBM%(T1,S1)=0THENGOSUB2200:NU=NU+1:IFNU>NTHEN410
390 S1=S1+1:IFS1>20THENS1=0:T1=T1+1
400 IFT1<TF+1THEN380
410 PRINT""
420 CLOSE3
430 S=S1+1:IFS>20THENS=0:T1=T1+1
440 T=T1:IFT>TFTHEN500
450 D$="S":GOSUB3200:IFD$="D"THENNU=1:T1=T2:S1=S2:GOTO365
460 NU=1:T1=T:S1=S:GOTO270
500 REM FINISHED XFERS
530 PRINT:PRINT"BACKUP COMPLETE FOR THIS DISK"
532 INPUT"ANOTHER DISK 1-YES 2-NO";YN
534 IFYN=2THENCLOSE1:CLOSE3:POKE55,PEEK(998):POKE56,PEEK(999):CLR:END
536 IFYN=1THENPRINT"INSERT OTHER DISK HIT ANY KEY"
537 GETT$:IFT$=""GOTO537
538 T1=T2:S1=S2:NU=1:GOTO365
539 GOTO532
2000 REM READ BLOCK T1,S1 TO BUFFER # NU
2010 C=.
2020 PRINT#1,"U1";3;0;T1;S1
2030 GOSUB3000:IFNOTERTHEN2060
2040 C=C+1:IFC<3GOTO2020
2050 PRINTER$:FORJ=(BB+NU)*256TO(BB+NU)*256+255:POKEJ,.:NEXTJ:GOTO2100
2060 PRINT#1,"B-P";3;0
2070 IFNU<>0THENPRINT" [157][157][157]";RIGHT$(" "+STR$(NU),3);"[157][157][157]";
2080 POKE996,PEEK(3):POKE997,PEEK(4):POKE4,BB+NU:SYSMA
2085 POKE3,PEEK(996):POKE4,PEEK(997)
2090 IFST<>.ANDST<>64THENGOSUB3000:GOTO2050
2100 RETURN
2200 REM WRITE BLOCK T1,S1 FROM BUFFER # NU
2210 C=.
2220 PRINT#1,"B-A";0;T1;S1:PRINT#1,"B-P";3;0
2230 PRINT" [157][157][157]";RIGHT$(" "+STR$(NU),3);"[157][157][157]";
2240 POKE996,PEEK(3):POKE997,PEEK(4):POKE4,BB+NU:SYSMA+3
2245 POKE3,PEEK(996):POKE4,PEEK(997)
2250 IFST<>.ANDST<>64THENPRINT"IEEE WRITE ERROR"ST"[146]":GOTO10000
2260 PRINT#1,"U2";3;0;T1;S1
2270 GOSUB3000:IFNOTERTHEN2300
2280 C=C+1:IFC<3THEN2260
2290 PRINT"UNRECOVERABLE WRITE ERROR"ER$:GOTO10000
2300 RETURN
2500 REM GET BAM TO BM%(T,S)
2510 TS=1:TF=.
2520 PRINT#1,"I0":OPEN3,8,3,"#"
2530 S9=0
2540 PRINT"TRACK # BLOCKS TO XFER"
2550 PRINT"[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
2560 NU=0:T1=18:S1=0:C0$=CHR$(.):GOSUB2000
2570 BY=4
2580 T%=(BY-4)/4+1
2590 PRINT" ";T%;
2600 IFPEEK(BA+BY)=.THENFORJ=.TO20:BM%(T%,J)=.:NEXTJ:BY=BY+4:GOTO2650
2610 S=0
2620 BY=BY+1:A0=PEEK(BA+BY):FORJ=.TO7:BM%(T%,S)=A0ANDTA(J):S=S+1:NEXT
2630 IFS<22THEN2620
2640 BY=BY+1
2650 ES=21:IFT%>17THENES=19
2660 IFT%>24THENES=18
2670 IFT%>30THENES=17
2680 FORJ=ESTO24:BM%(T%,J)=-1:NEXT
2690 SM=.:FORJ=.TO20:IFBM%(T%,J)=.THENSM=SM+1
2700 NEXT:PRINTTAB(12);SM:S9=S9+SM
2710 IFSM=.ANDTS=T%THENTS=TS+1:GOTO2730
2720 IFSM<>.THENTF=T%
2730 IFBY<143THEN2580
2740 CLOSE3
2750 PRINT"START =";TS;" FINISH =";TF
2760 PRINT"A TOTAL OF";S9;"BLOCKS TO XFER"
2770 S8=90+25+(.650+.980)*S9
2780 S7=INT(S8/60):PRINT"APPROX";S7;":"INT(S8-S7*60);"FOR COPY"
2790 RETURN
3000 REM READ ERR CH TO ER,ER$
3010 INPUT#1,E0$,E1$,E2$,E3$:ER$=E0$+","+E1$+","+E2$+","+E3$
3020 ER=LEN(E0$):IFERTHENER=VAL(E0$)
3030 RETURN
3200 REM REM INSTRUCT TO SWAP DISK GIVEN IN D$
3210 IFD$="D"THENS1$="DESTINATION":GOTO3230
3211 INPUT"ANOTHER DISK Y/N";YN$
3212 IFYN$="N"THENT1=T2:S1=S2:GOTO3220
3213 IFYN$="Y"THEND$="D":GOTO3230
3214 GOTO3211
3220 S1$="SOURCE"
3230 PRINT"INSERT ";S1$;" DISK, PRESS [146]"
3240 GETA$:IFA$<>" "THEN3240
3250 OPEN2,8,0,"$0"
3260 GOSUB3000:IFER>0THEN10000
3300 CLOSE2:RETURN
10000 REM DROP OUT
10010 POKE55,PEEK(998):POKE56,PEEK(999):CLR:STOP
15000 DATA76,66,3,76,91,3,162,3,32,198,255,160,0,132,3,32,207,255,145
15010 DATA3,165,144,208,3,200,208,244,32,204,255,96,162,3,32,201,255,160
15020 DATA0,132,3,177,3,32,210,255,165,144,208,3,200,208,244,32,204,255,96